<?php
/**
 * This file is application-wide controller file. 
 *
 * @copyright     Copyright 2008-2010, LilCake.net
 * @link          http://lilcake.net LilCake.net
 * @package       lil_blogs
 * @subpackage    lil_blogs.app
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */

/**
 * Application-wide controller class.
 *
 * This class contains application-wide methods. All other controllers will inherit them.
 *
 * @package       lil_blogs
 * @subpackage    lil_blogs.app
 */
class AppController extends Controller {
/**
 * components property
 *
 * @var bool
 * @access public
 */
	var $components = array('Auth');
/**
 * beforeFilter method
 *
 * @access public
 * @return void
 */
	function beforeFilter() {
		parent::beforeFilter();
		
		// necessary for auth component
		App::import('Model', 'Lil.User');
		
		$this->Auth->loginRedirect	= '/admin';
		$this->Auth->logoutRedirect	= '/';
		$this->Auth->loginAction	= '/login';
		$this->Auth->userModel		= 'User';
		$this->Auth->fields			= array('username' => 'username', 'password' => 'passwd');
		$this->Auth->authorize		= 'controller';
		$this->Auth->sessionKey		= 'Auth.User';
		$this->Auth->loginError		= __('Wrong username or password. Please try again.', true);
		$this->Auth->authError		= __('User must be logged in.', true);
		
		$this->set('Auth', $this->Auth->user());
	}
}
?>